<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link id="favicon" href="favicon.ico" rel="icon" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户注册</title>
<link rel="stylesheet" href="css/all.css" />
<link rel="stylesheet" href="css/login.css" />
<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script type="text/javascript" src="js/idvalidate.js"></script>
<script language="javascript" type="application/javascript">
	$(document).ready(function(){
		$.validator.setDefaults({       
			submitHandler: function(form) {    
				form.submit();
			}
		});
		jQuery.validator.addMethod("stringCheck", function(value, element) {       
			return this.optional(element) || /^[\u0391-\uFFE5\w]+$/.test(value);       
		}, "只能包括中文字、英文字母、数字和下划线");
		jQuery.validator.addMethod("engCheck", function(value, element) {       
			return this.optional(element) || /^[\w]+$/.test(value);       
		}, "只能包括英文字母、数字和下划线");
		jQuery.validator.addMethod("chnCheck", function(value, element) {       
			return this.optional(element) || /^[\u0391-\uFFE5]+$/.test(value);       
		}, "只能包括中文字");
		jQuery.validator.addMethod("byteRangeLength", function(value, element, param) {       
			var length = value.length;
			for(var i = 0; i < value.length; i++){       
				if(value.charCodeAt(i) > 127){       
				length++;
				}       
			}
			return this.optional(element) || ( length >= param[0] && length <= param[1] );       
		}, "请确保输入的值在3-15个字节之间(一个中文字算2个字节)");
		jQuery.validator.addMethod("isIdCardNo", function(value, element) {       
			return this.optional(element) || IdCardValidate(value);       
		}, "请正确输入您的身份证号码");
		jQuery.validator.addMethod("isMobile", function(value, element) {       
			var length = value.length;   
			var mobile = /^(((13[0-9]{1})|(15[0-9]{1})|(18[02356789]{1}))+\d{8})$/;   
			return this.optional(element) || (length == 11 && mobile.test(value));       
		}, "请正确填写您的手机号码");
		jQuery.validator.addMethod("isSameP", function(value, element) {
			return this.optional(element) || (value == $('#password').val());       
		}, "与密码不一致");
		jQuery.validator.addMethod("isGoodAge", function(value, element) {
			var age = /^\d{1,2}$/;   
			return this.optional(element) || age.test(value);       
		}, "请正确填写年龄");
		$('#submitForm').validate({
			rules:{
				username:{
					required:true,
					engCheck:true,
					byteRangeLength:[3,15],
					remote:{
						url: '/jxgl/checkName',
						type: 'POST',
						cache: false,
						data:{
							username:function(){
								return $('#username').val();
							}							
						}						
					}
				},
				realName:{
					required:true,
					chnCheck:true,
					byteRangeLength:[4,8]
				},
				password:{
					required:true
				},
				repassword:{
					required:true,
					isSameP:true
				},
				idcard:{
					required:true,
					isIdCardNo:true
				},
// 				age:{
// 					required:true,
// 					isGoodAge:true
// 				},
				address:{
					required:true,
					byteRangeLength:[3,20]
				},
				phone:{
					required:true,
					isMobile:true
				}				
			},
			messages:{
				username:{
					required:'请填写用户名',
					engCheck:'只能是数字下划线字母',
					byteRangeLength:'字符数目在3-15',
					remote:'用户名已存在'
				},
				realName:{
					required:'请填写姓名',
					chnCheck:'只能包含中文字符',
					byteRangeLength:'字符数目在2-4'				
				},
				password:{
					required:'请输入密码'
				},
				repassword:{
					required:'请确认密码',
					isSameP:'两次密码不一致'
				},				
				idcard:{
					required:'请输入身份证号码',
					isIdCardNo:'违规身份证号'
				},
// 				age:{
// 					required:'请输入年龄',
// 					isGoodAge:'请输入合适的年龄'
// 				},
				address:{
					required:'请输入地址',
					byteRangeLength:'字符数目不超过20'
				},
				phone:{
					required:'请输入手机',
					isMobile:'手机号码格式不正确'
				}
			},
			focusInvalid: false,
			onkeyup: false,
			errorPlacement:function(error,element){
				error.appendTo(element.parent());
			}
		});
	});
</script>

</head>
<body id="lg_body">
	<div id="lg_wrap">
		<div id="ln_header">
			<div class="header_logo_bg">
				<div class="header_link"> 
						<a target="_blank" href="http://www.changdajx.cn/%E8%81%94%E7%B3%BB%E6%88%91%E4%BB%AC/"
						class="help_icon">问题咨询</a>&nbsp;&nbsp; 
						<a target="_blank"
						href="http://www.changdajx.cn"
						class="home_icon">驾校首页</a>&nbsp;&nbsp;
				</div>
			</div>
		</div>
		<div class="main_link">
			<a href="/jxgl/login"><b>首页</b></a> &gt; <font color="#666666">用户注册</font>
		</div>
		<div id="ln_main" style="height:650px;">			
			<div id="main_right" style="height:653px;width:640px;">
            	<div class="login_box" style="border-left:none;height:710px;">
                	<div class="user_login_tit" style="width:412px;">
						<ul class="tsearch-tab clearfix">
							<li class="current"><a href="login.html">学员注册</a></li>							
						</ul>
					</div>
                    <div class="tabline">
					</div>                    
                    <form action="register" method="POST" id="submitForm">
                    	<div class="user_login_table" style="height:710px;width:520px">
                    	<div class="username">
                            <div class="login_name">
                                用户名:
                            </div>
                            <div>
                                <input type="text" tabindex="1" class="input_box" id="username" name="username">
                            </div>
                        </div>
                        <div class="password">
                            <div class="login_name">
                                密码:
                            </div>
                            <div>
                                <input type="password" tabindex="2" class="input_box" id="password" name="password">                                
                            </div>                            
                        </div>
                        <div class="password">
                            <div class="login_name">
                                密码确认:
                            </div>
                            <div>
                                <input type="password" tabindex="2" class="input_box" id="repassword" name="repassword">                                
                            </div>                            
                        </div>
                        <div class="username">
                            <div class="login_name">
                                真实姓名:
                            </div>
                            <div>
                                <input type="text" tabindex="1" class="input_box" id="realName" name="realName">
                            </div>
                        </div>
<!--                         <div class="username"> -->
<!--                             <div class="login_name"> -->
<!--                                 身份证号: -->
<!--                             </div> -->
<!--                             <div> -->
<!--                                 <input type="text" tabindex="1" class="input_box" id="idcard" name="idcard"> -->
<!--                             </div> -->
<!--                         </div> -->
                        <div class="username">
                            <div class="login_name">
                                驾车类型:
                            </div>
                            <div style="padding-top:5px">
                                <input type="radio" tabindex="1" id="carType" name="carType" value="0" checked>手动
                                <input type="radio" tabindex="1" id="carType" name="carType" value="1" style="padding-left:50px">自动
                            </div>
                        </div>
<!--                         <div class="username"> -->
<!--                             <div class="login_name"> -->
<!--                                 年龄: -->
<!--                             </div> -->
<!--                             <div> -->
<!--                                 <input type="text" tabindex="1" class="input_box" id="age" name="age"> -->
<!--                             </div> -->
<!--                         </div> -->
<!--                         <div class="username"> -->
<!--                             <div class="login_name"> -->
<!--                                 性别: -->
<!--                             </div> -->
<!--                             <div style="padding-top:5px"> -->
<!--                                 <input type="radio" tabindex="1" id="gender" name="gender" value="0" checked>男 -->
<!--                                 <input type="radio" tabindex="1" id="gender" name="gender" value="1" style="padding-left:50px">女 -->
<!--                             </div> -->
<!--                         </div> -->
                        <div class="username">
                            <div class="login_name">
                                接送地址:
                            </div>
                            <div>
                                <input type="text" tabindex="1" class="input_box" id="address" name="address">
                            </div>
                        </div>
                                                <div class="username">
                            <div class="login_name">
                                手机号码:
                            </div>
                            <div>
                                <input type="text" tabindex="1" class="input_box" id="phone" name="phone">
                            </div>
                        </div>
                        <div class="login_btn">                        	
							<input name="register" type="submit" value="注册" class="login_btn_style">
						</div>
					</div>                    </form>
                </div>				
			</div>
		</div>
	</div>
</body>
</html>
<body>
</body>
</html>